import React from 'react';
import ReactDOM from 'react-dom';
import {applyMiddleware,compose, createStore} from 'redux'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'
import {BrowserRouter,Route,redirect,Switch} from 'react-router-dom'
import reducers from './reducer'
import './config'
import Login from './containw/login/login'
import Register from './containw/register/resgister'
import AuthRoute from './components/authroute/authroute'


const store = createStore (reducers,compose(
    applyMiddleware(thunk),
    window.devToolsExtension?window.devToolsExtension():f=>f
))
function Boss(){
    return <h2>boss页面</h2>
}

ReactDOM.render(<Provider store={store}>
    <BrowserRouter>
        <div>
        <AuthRoute></AuthRoute>
        <Route path= '/boss' component ={Boss}></Route>
            <Route path= '/login' component ={Login}></Route>
            <Route path= '/resgiter' component ={Register}></Route>
        </div>
    </BrowserRouter>
</Provider>, document.getElementById('root'));
// ReactDOM.render(
//    <Login></Login>, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
// serviceWorker.unregister();
